package 慕课网.homework;

public class staff {
    private String staffName;
    private String staffNo;
    private String sex;
    private String dep;
    private int age;
    private duty myduty;
    public staff(){

    }
    public staff(String staffName,String staffNo,String sex,int age,duty myduty,String dep){
        this.setStaffName(staffName);
        this.setStaffNo(staffNo);
        this.setAge(age);
        this.setMyduty(myduty);
        this.setSex(sex);
        this.setDep(dep);
    }

    public String getDep() {
        return dep;
    }

    public void setDep(String dep) {
        this.dep = dep;
    }

    public String getStaffNo() {
        return staffNo;
    }

    public void setStaffNo(String staffNo) {
        this.staffNo = staffNo;
    }

    public String getStaffName() {
        return staffName;
    }

    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        if(sex.equals("女"))
        {
            this.sex = sex;
        }
        else
        {
            this.sex="男";
        }
    }

    public duty getMyduty() {
        if(myduty==null)
            this.myduty=new duty();
        return myduty;
    }

    public void setMyduty(duty myduty) {
        this.myduty = myduty;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age>=18&&age<=65)
        {
            this.age = age;
        }
        else
        {
            this.age=18;
        }
    }
    public String introduction(){
        String str="姓名："+this.getStaffName()
                +"\n工号："+this.getStaffNo()
                +"\n性别："+this.getSex()
                +"\n职务："+this.getDep()+this.getMyduty().getDutyName()+"\n";
        return str;
    }
}
